\(\int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx\) [761]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 43 \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=-2 a^2 x+\frac {2 a^2 \cos (c+d x)}{d}+\frac {\sec (c+d x) (a+a \sin (c+d x))^2}{d} \]

[Out]

-2*a^2*x+2*a^2*cos(d*x+c)/d+sec(d*x+c)*(a+a*sin(d*x+c))^2/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.080, Rules used = {2934, 2718} \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=\frac {2 a^2 \cos (c+d x)}{d}-2 a^2 x+\frac {\sec (c+d x) (a \sin (c+d x)+a)^2}{d} \]

[In]

Int[Sec[c + d*x]*(a + a*Sin[c + d*x])^2*Tan[c + d*x],x]

[Out]

-2*a^2*x + (2*a^2*Cos[c + d*x])/d + (Sec[c + d*x]*(a + a*Sin[c + d*x])^2)/d

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 2934

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Simp[(-(b*c + a*d))*(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^m/(a*f*g*(p +
 1))), x] + Dist[b*((a*d*m + b*c*(m + p + 1))/(a*g^2*(p + 1))), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*
x])^(m - 1), x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && EqQ[a^2 - b^2, 0] && GtQ[m, -1] && LtQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {\sec (c+d x) (a+a \sin (c+d x))^2}{d}-(2 a) \int (a+a \sin (c+d x)) \, dx \\ & = -2 a^2 x+\frac {\sec (c+d x) (a+a \sin (c+d x))^2}{d}-\left (2 a^2\right ) \int \sin (c+d x) \, dx \\ & = -2 a^2 x+\frac {2 a^2 \cos (c+d x)}{d}+\frac {\sec (c+d x) (a+a \sin (c+d x))^2}{d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(119\) vs. \(2(43)=86\).

Time = 0.49 (sec) , antiderivative size = 119, normalized size of antiderivative = 2.77 \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=-\frac {a^2 \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (5+8 \arcsin \left (\frac {\sqrt {1-\sin (c+d x)}}{\sqrt {2}}\right ) \sqrt {\cos ^2(c+d x)}+\cos (2 (c+d x))+4 \sin (c+d x)\right )}{2 d \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) (-1+\sin (c+d x))} \]

[In]

Integrate[Sec[c + d*x]*(a + a*Sin[c + d*x])^2*Tan[c + d*x],x]

[Out]

-1/2*(a^2*(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])*(5 + 8*ArcSin[Sqrt[1 - Sin[c + d*x]]/Sqrt[2]]*Sqrt[Cos[c + d*x
]^2] + Cos[2*(c + d*x)] + 4*Sin[c + d*x]))/(d*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])*(-1 + Sin[c + d*x]))

Maple [A] (verified)

Time = 0.15 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.26

method result size
parallelrisch \(\frac {a^{2} \left (-4 d x \cos \left (d x +c \right )+\cos \left (2 d x +2 c \right )+4 \sin \left (d x +c \right )+6 \cos \left (d x +c \right )+5\right )}{2 d \cos \left (d x +c \right )}\) \(54\)
risch \(-2 a^{2} x +\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {4 a^{2}}{d \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}\) \(64\)
derivativedivides \(\frac {a^{2} \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+2 a^{2} \left (\tan \left (d x +c \right )-d x -c \right )+\frac {a^{2}}{\cos \left (d x +c \right )}}{d}\) \(76\)
default \(\frac {a^{2} \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+2 a^{2} \left (\tan \left (d x +c \right )-d x -c \right )+\frac {a^{2}}{\cos \left (d x +c \right )}}{d}\) \(76\)
norman \(\frac {2 a^{2} x -\frac {6 a^{2}}{d}-\frac {4 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {8 a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {4 a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+2 a^{2} x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 a^{2} x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 a^{2} x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {2 a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {8 a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) \(191\)

[In]

int(sec(d*x+c)^2*sin(d*x+c)*(a+a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/2/d*a^2*(-4*d*x*cos(d*x+c)+cos(2*d*x+2*c)+4*sin(d*x+c)+6*cos(d*x+c)+5)/cos(d*x+c)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 101 vs. \(2 (43) = 86\).

Time = 0.29 (sec) , antiderivative size = 101, normalized size of antiderivative = 2.35 \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=-\frac {2 \, a^{2} d x - a^{2} \cos \left (d x + c\right )^{2} - 2 \, a^{2} + {\left (2 \, a^{2} d x - 3 \, a^{2}\right )} \cos \left (d x + c\right ) - {\left (2 \, a^{2} d x - a^{2} \cos \left (d x + c\right ) + 2 \, a^{2}\right )} \sin \left (d x + c\right )}{d \cos \left (d x + c\right ) - d \sin \left (d x + c\right ) + d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)*(a+a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-(2*a^2*d*x - a^2*cos(d*x + c)^2 - 2*a^2 + (2*a^2*d*x - 3*a^2)*cos(d*x + c) - (2*a^2*d*x - a^2*cos(d*x + c) +
2*a^2)*sin(d*x + c))/(d*cos(d*x + c) - d*sin(d*x + c) + d)

Sympy [F]

\[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=a^{2} \left (\int \sin {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int 2 \sin ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int \sin ^{3}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx\right ) \]

[In]

integrate(sec(d*x+c)**2*sin(d*x+c)*(a+a*sin(d*x+c))**2,x)

[Out]

a**2*(Integral(sin(c + d*x)*sec(c + d*x)**2, x) + Integral(2*sin(c + d*x)**2*sec(c + d*x)**2, x) + Integral(si
n(c + d*x)**3*sec(c + d*x)**2, x))

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.33 \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=-\frac {2 \, {\left (d x + c - \tan \left (d x + c\right )\right )} a^{2} - a^{2} {\left (\frac {1}{\cos \left (d x + c\right )} + \cos \left (d x + c\right )\right )} - \frac {a^{2}}{\cos \left (d x + c\right )}}{d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)*(a+a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-(2*(d*x + c - tan(d*x + c))*a^2 - a^2*(1/cos(d*x + c) + cos(d*x + c)) - a^2/cos(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 89 vs. \(2 (43) = 86\).

Time = 0.32 (sec) , antiderivative size = 89, normalized size of antiderivative = 2.07 \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=-\frac {2 \, {\left ({\left (d x + c\right )} a^{2} + \frac {2 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1}\right )}}{d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)*(a+a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

-2*((d*x + c)*a^2 + (2*a^2*tan(1/2*d*x + 1/2*c)^2 - a^2*tan(1/2*d*x + 1/2*c) + 3*a^2)/(tan(1/2*d*x + 1/2*c)^3
- tan(1/2*d*x + 1/2*c)^2 + tan(1/2*d*x + 1/2*c) - 1))/d

Mupad [B] (verification not implemented)

Time = 9.64 (sec) , antiderivative size = 117, normalized size of antiderivative = 2.72 \[ \int \sec (c+d x) (a+a \sin (c+d x))^2 \tan (c+d x) \, dx=-2\,a^2\,x-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^2\,\left (d\,x-1\right )-2\,a^2\,d\,x\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (2\,a^2\,\left (d\,x-2\right )-2\,a^2\,d\,x\right )-2\,a^2\,\left (d\,x-3\right )+2\,a^2\,d\,x}{d\,\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-1\right )\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \]

[In]

int((sin(c + d*x)*(a + a*sin(c + d*x))^2)/cos(c + d*x)^2,x)

[Out]

- 2*a^2*x - (tan(c/2 + (d*x)/2)*(2*a^2*(d*x - 1) - 2*a^2*d*x) - tan(c/2 + (d*x)/2)^2*(2*a^2*(d*x - 2) - 2*a^2*
d*x) - 2*a^2*(d*x - 3) + 2*a^2*d*x)/(d*(tan(c/2 + (d*x)/2) - 1)*(tan(c/2 + (d*x)/2)^2 + 1))